package cn.com.greatwall.common.exception;

import cn.com.greatwall.common.utils.StringUtils;

/**
 * @Author herw
 * @Time 2020-06-28 9:09:31 AM
 * @Version 1.0
 * @Description:
 */
public class EntityNotFoundException extends RuntimeException {
    public EntityNotFoundException(Class clazz, String field, String val) {
        super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val));
    }

    private static String generateMessage(String entity, String field, String val) {
        return StringUtils.capitalize(entity) + " with " + field + " " + val + " does not exist";
    }
}
